Skip to content

fix(backend): use BigInt for on-chain streamId (u64-safe) - #998

Merged
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
TCROWN10:fix/829-streamid-bigint-pr
Jul 30, 2026
Merged

fix(backend): use BigInt for on-chain streamId (u64-safe)#998
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
TCROWN10:fix/829-streamid-bigint-pr

Conversation

@TCROWN10

Copy link
Copy Markdown
Contributor

Summary

  • Change Stream.streamId and StreamEvent.streamId from Prisma Int (Postgres int4) to BigInt, with a migration that widens both columns and recreates the FK.
  • Stop coercing decoded Soroban u64 IDs with Number(...); parse route/body IDs via parseStreamId() and serialize BigInt safely for JSON/SSE.
  • Add tests for u64 IDs above int4 max (3_000_000_000n) through the worker and validator.

Closes #829

Test plan

  • Focused vitest suite for stream-id helpers, worker large-id path, and stream action/integration expectations
  • CI green (Postgres migration applied in CI)
  • Confirm a stream with streamId > 2147483647 persists and is readable via GET /v1/streams/:id

Widen Stream.streamId / StreamEvent.streamId to Postgres bigint and keep
decoded u64 values as JS bigint through the worker and API parsers so IDs
above int4 max no longer fail inserts. Adds a migration and regression
coverage for ids > 2^31-1.

Closes LabsCrypt#829

Co-authored-by: Cursor <cursoragent@cursor.com>
@TCROWN10
TCROWN10 force-pushed the fix/829-streamid-bigint-pr branch from 9edd559 to 2c5b87d Compare July 30, 2026 10:11
@ogazboiz
ogazboiz merged commit 536a475 into LabsCrypt:main Jul 30, 2026
5 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] Stream.streamId / StreamEvent.streamId typed Int (int4) but on-chain IDs are u64 - overflow/insert failure

2 participants